import { request } from '@pkg/request/src';

export enum Api {
  page = '/employee/page',
  employeeList = '/employee/list',
  get = '/employee/get',
  add = '/employee/save',
  copyAdd = '/employee/copyAdd',
  update = '/employee/update',
  changeJobState = '/employee/changeJobState',
  querySetAirport = '/employee/querySetAirport',
  setAirport = '/employee/setAirport',
  remove = '/employee/remove',
  resetPassWord = '/employee/resetPassWord',
  adjust = '/employee/adjust',
  getTargetList = '/employee/getTargetList',
  isExistByAccount = '/employee/isExistByAccount',
  initEmployeeCode = '/employee/initEmployeeCode',
}

export const employeeList = params =>
  request.get(
    {
      url: Api.employeeList,
      params: params,
    },
    { errorMessageMode: 'none', successMessageMode: 'none' },
  );

export const getEmployeeDetail = params =>
  request.get(
    {
      url: Api.get,
      params: params,
    },
    { errorMessageMode: 'none', successMessageMode: 'none' },
  );

export const resetPassWord = params =>
  request.post(
    {
      url: Api.resetPassWord,
      params: params,
    },
    { errorMessageMode: 'message' },
  );

export const adjust = params =>
  request.post(
    {
      url: Api.adjust,
      params: params,
    },
    { errorMessageMode: 'message' },
  );

export const getTargetList = params =>
  request.get(
    {
      url: Api.getTargetList,
      params: params,
    },
    { errorMessageMode: 'none', successMessageMode: 'none' },
  );

export const querySetAirport = params =>
  request.get(
    {
      url: Api.querySetAirport,
      params: params,
    },
    { errorMessageMode: 'none' },
  );

export const setAirport = params =>
  request.post(
    {
      url: Api.setAirport,
      params: params,
    },
    { errorMessageMode: 'none' },
  );
export const isExistByAccount = (employeeAccount: string) =>
  request.post(
    {
      url: Api.isExistByAccount,
      params: { employeeAccount: employeeAccount },
    },
    { errorMessageMode: 'none' },
  );
export const copyAdd = params =>
  request.post(
    {
      url: Api.copyAdd,
      params: params,
    },
    { errorMessageMode: 'message' },
  );
export const initEmployeeCode = params =>
  request.post(
    {
      url: Api.initEmployeeCode,
      params: params,
    },
    { errorMessageMode: 'message', successMessageMode: 'success' },
  );
